//
//  SearchFoodView.m
//  Tour
//
//  Created by hesiyao on 16/3/10.
//  Copyright © 2016年 张中烨. All rights reserved.
//

#import "SearchFoodView.h"

@implementation SearchFoodView

//-(instancetype)initWithFrame:(CGRect)frame
//{
//    self = [super initWithFrame:frame];
//    if (self) {
//        [self createSubviews];
//    }
//    return self;
//}

-(instancetype)initWithFrame:(CGRect)frame WithdetailIntrolduce:(NSString *)introlduce WithDetailAddress:(NSString *)address WithDetailRoutiue:(NSString *)routiue WithDetailTime:(NSString *)time
{
    self = [super initWithFrame:frame];
    if (self) {
        //设置size
        CGSize size = CGSizeMake(SCREEN_WIDTH - 20, 1000);
        
        //图片
        self.titleImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 4)];
        self.titleImage.contentMode = UIViewContentModeScaleAspectFill;
        self.titleImage.clipsToBounds = YES;
        [self addSubview:_titleImage];
        //店铺名称
        self.titleName = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _titleImage.frame.origin.y + _titleImage.frame.size.height, SCREEN_WIDTH - 20, SCREEN_HEIGHT / 20)];
        [self addSubview:_titleName];
        //简介
        self.introduce = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _titleName.frame.origin.y + _titleName.frame.size.height, _titleName.frame.size.width, _titleName.frame.size.height)];
        [self addSubview:_introduce];
        _introduce.text = @"简介";
        //详细介绍
        CGFloat heightWithIntrolduce = [[self class] heightWith:introlduce size:size];
        self.detailIntroduce = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _introduce.frame.origin.y + _introduce.frame.size.height, _titleName.frame.size.width, heightWithIntrolduce)];
        [self addSubview:_detailIntroduce];
        self.detailIntroduce.font = [UIFont systemFontOfSize:15];
        self.detailIntroduce.textColor = [UIColor grayColor];
        self.detailIntroduce.numberOfLines = 0;
        //地址
        self.address = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _detailIntroduce.frame.origin.y + _detailIntroduce.frame.size.height, _titleName.frame.size.width, _titleName.frame.size.height)];
        self.address.text = @"地址";
        [self addSubview:_address];
        //详细地址
        CGFloat heightWithAddress = [[self class] heightWith:address size:size];
        self.detailAddress = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _address.frame.origin.y + _address.frame.size.height, _titleName.frame.size.width, heightWithAddress)];
        self.detailAddress.font = [UIFont systemFontOfSize:15];
        self.detailAddress.textColor = [UIColor grayColor];
        self.detailAddress.numberOfLines = 0;
        [self addSubview:_detailAddress];
        //路线
        self.routiue = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _detailAddress.frame.origin.y + _detailAddress.frame.size.height, _titleName.frame.size.width, _titleName.frame.size.height)];
        self.routiue.text = @"路线";
        [self addSubview:_routiue];
        //详细路线
        CGFloat heightWithRoutiue = [[self class] heightWith:routiue size:size];
        self.detailRoutiue = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _routiue.frame.origin.y + _routiue.frame.size.height, _titleName.frame.size.width, heightWithRoutiue)];
        [self addSubview:_detailRoutiue];
        self.detailRoutiue.font = [UIFont systemFontOfSize:15];
        self.detailRoutiue.textColor = [UIColor grayColor];
        self.detailRoutiue.numberOfLines = 0;
        
        //电话
        self.phone = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _detailRoutiue.frame.origin.y + _detailRoutiue.frame.size.height, _titleName.frame.size.width, _titleName.frame.size.height)];
        [self addSubview:_phone];
        _phone.text = @"电话";
        //详细电话
        self.detailPhone = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _phone.frame.origin.y + _phone.frame.size.height, _titleName.frame.size.width / 3 * 2, _titleName.frame.size.height)];
        [self addSubview:_detailPhone];
        self.detailPhone.font = [UIFont systemFontOfSize:15];
        self.detailPhone.textColor = [UIColor grayColor];
        self.detailPhone.numberOfLines = 0;
        
        //时间
        self.time = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _detailPhone.frame.origin.y + _detailPhone.frame.size.height, _titleName.frame.size.width, _titleName.frame.size.height)];
        [self addSubview:_time];
        _time.text = @"时间";
        //详细时间
        CGFloat heightWithTime = [[self class] heightWith:time size:size];
        self.detailTime = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _time.frame.origin.y + _time.frame.size.height, _titleName.frame.size.width, heightWithTime)];
        [self addSubview:_detailTime];
        self.detailTime.font = [UIFont systemFontOfSize:15];
        self.detailTime.textColor = [UIColor grayColor];
        self.detailTime.numberOfLines = 0;
        //门票
        self.ticket = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _detailTime.frame.origin.y + _detailTime.frame.size.height, _titleName.frame.size.width, _titleName.frame.size.height)];
        [self addSubview:_ticket];
        _ticket.text = @"门票";
        //详细门票
        self.detailTicket = [[BaseLabel alloc] initWithFrame:CGRectMake(10, _ticket.frame.origin.y + _ticket.frame.size.height, _titleName.frame.size.width, _titleName.frame.size.height)];
        [self addSubview:_detailTicket];
        self.detailTicket.font = [UIFont systemFontOfSize:15];
        self.detailTicket.textColor = [UIColor grayColor];
        self.detailTicket.numberOfLines = 0;
        
        NSLog(@"view:%f %f %f %f",heightWithIntrolduce,heightWithAddress, heightWithRoutiue,heightWithTime);
    }
    return self;
}

-(void)createSubviews
{
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
